#include "Comm.hpp"

int main()
{
    int wfd = open(PATH, O_WRONLY);
    if (wfd < 0)
    {
        cout << "fail to write open fifo errno is " << errno << " strerror is " << strerror(errno) << endl;
        return 1;
    }
    string inbuffer;
    while (1)
    {
        cout << "please input your message" << endl;
        getline(cin, inbuffer);
        if (inbuffer == "quit")
            break;
        int n = write(wfd, inbuffer.c_str(), inbuffer.size());
        if (n < 0)
        {
            cout << "fail to write errno is " << errno << " strerror is " << strerror(errno) << endl;
            break;
        }
    }
    close(wfd);
    return 0;
}